//
//  YSSlideMenuViewController.m
//  YSKitDemo
//
//  Created by MOLBASE on 2018/8/14.
//  Copyright © 2018年 YangShen. All rights reserved.
//

#import "YSSlideMenuViewController.h"
#import "YSCenterViewController.h"
#import "YSLeftViewController.h"
#import "YSRightViewController.h"
#import "YSSlideMenu.h"

@interface YSSlideMenuViewController ()

@end

@implementation YSSlideMenuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"SlideMenu";

    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"显示" style:UIBarButtonItemStylePlain target:self action:@selector(showSlideMenu)];

}

- (void)showSlideMenu {
    //主界面
    YSCenterViewController *centerVC = [[YSCenterViewController alloc] init];
    //配置NavigationBar
    UINavigationController *rootNav = [[UINavigationController alloc] initWithRootViewController:centerVC];
    [rootNav.navigationBar setBackgroundImage:[UIImage imageNamed:@"navbarBackImage"] forBarMetrics:UIBarMetricsDefault];
    rootNav.navigationBar.tintColor = [UIColor whiteColor];
    [rootNav.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName, nil]];

    //左侧菜单
    YSLeftViewController *leftVC = [[YSLeftViewController alloc] init];
    //右侧菜单
    YSRightViewController *rightVC = [[YSRightViewController alloc] init];
    //创建滑动菜单
    YSSlideMenu *slideMenu = [[YSSlideMenu alloc] initWithRootViewController:rootNav];
    //设置左右菜单
    slideMenu.leftViewController = leftVC;
    slideMenu.rightViewController = rightVC;

    [self presentViewController:slideMenu animated:YES completion:nil];
    
}


@end
